package getpackage;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.DriverManager;

public abstract class Get{
	protected Connection getConnection() throws SQLException{
        return DriverManager.getConnection("jdbc:apache:commons:dbcp:/pool");
    }
	
	public int getInsert(){
        Connection conn = null;
        PreparedStatement pstmt = null;
 	    ResultSet rs = null;
        
        try {
        	conn = getConnection();

            pstmt = conn.prepareStatement("select LAST_INSERT_ID() AS number");
            
            rs = pstmt.executeQuery();
            int a = 0;
            if(rs.next()){
	            long id = rs.getLong("number");
	            a = (int)id;
            }
    
            return a;
        } catch(SQLException ex) {
            
        } finally {
            if (pstmt != null) try { pstmt.close(); } catch(SQLException ex) {}
            if (conn != null) try { conn.close(); } catch(SQLException ex) {}
        }
		return 0;
    }
	
	public <T> T getDB(String str){
		return null;
	}
	
	public <T> T getDB(int i){
		return null;
	}
}